package com.elasticjob.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author: TongRui乀
 * @Date: 2019-12-11 16:35
 * @description：
 */
@Slf4j
public class MySimpleJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {

        /*log.info("当前job名称：{}", shardingContext.getJobName());
        log.info("当前job总分片数：{}", shardingContext.getShardingTotalCount());
        log.info("当前job sharding item：{}", shardingContext.getShardingItem());
        log.info("当前job  参数：{}", shardingContext.getJobParameter());
        log.info("当前sharding  参数：{}", shardingContext.getShardingParameter());
        log.info("当前TaskId：{}", shardingContext.getTaskId());*/

        log.info("job1 当前sharding ：{} 当前时间：{}", shardingContext.getShardingItem(), DateTimeFormatter.ofPattern("HH:mm:ss").format(LocalTime.now()));

    }
}
